//
//  JoinQuizDetailVC.m
//  WanCaiC8
//
//  Created by tangang on 2018/3/14.
//  Copyright © 2018年 tangang. All rights reserved.
//

#import "JoinQuizDetailVC.h"
#import "JoinQuizDetailCell.h"
#import "JoinQuizDetailTopView.h"
#import "JoinQuizDetailSubmitView.h"
#import "JoinQuizSelectView.h"
#import "JoinQuizMoreView.h"
#import "PlanVM.h"
#import "InformationVM.h"
#import "OpenLotteryRecordVC.h"
#import "MyPlanVC.h"
@interface JoinQuizDetailVC ()<UITableViewDataSource,UITableViewDelegate>
@property (nonatomic ,strong) UITableView   *tableView;
@property (nonatomic ,strong) JoinQuizDetailTopView *topView;
@property (nonatomic ,strong) JoinQuizDetailSubmitView *submitView;
@property (nonatomic ,strong) NSMutableArray    *dataArr;
@property (nonatomic ,strong) QXLable           *labRotaryHeader;
@end

@implementation JoinQuizDetailVC{
    JoinQuizMoreView    *moreView;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    UIBarButtonItem *rightItem=[[UIBarButtonItem alloc]initWithTitle:@"规则" style:UIBarButtonItemStylePlain target:self action:@selector(onclickRules)];
    self.navigationItem.rightBarButtonItem=rightItem;
    
}

- (void)onclickRules{
    PublicWebVC *vc=[[PublicWebVC alloc]init];
    vc.lType=self.lType;
    vc.title=[NSString stringWithFormat:@"%@规则说明",self.title];
    [self.navigationController pushViewController:vc animated:YES];
}

- (void)backClick{
    [super backClick];
    [self.topView cancleTimer];
    [self.topView removeFromSuperview];
    self.topView=nil;
}

#pragma mark -- 获取当前用户某个彩种当前期号计划集合
- (void)getPlan{
    WS(weakSelf);
    [[PlanVM manage] getCurrentPlanWithLtype:self.lType Success:^(id returnValue) {
        [weakSelf compare:returnValue];
        [weakSelf.tableView reloadData];
    } andFail:^(NSString *errorMessage, NSError *error) {
        
    }];
}

- (void)compare:(NSArray *)arr{
    for (BetModel *betModel in arr) {
        if (betModel.lType==1) {
            ///福彩3D
            [betModel lottery3DWithData:self.dataArr];
        }else if (betModel.lType==2){
            ///双色球
            [betModel chromosphereWithData:self.dataArr];
        }else if (betModel.lType==3){
            ///七星彩
            [betModel sevenStarsWithData:self.dataArr];
        }else if (betModel.lType==4){
            ///大乐透
            [betModel bringsWithData:self.dataArr];
        }else if (betModel.lType==5){
            ///六合彩
            [betModel lotteryWithData:self.dataArr];
        }else if (betModel.lType==6){
            ///排列三
            [betModel arrangement3WithData:self.dataArr];
        }else if (betModel.lType==7){
            ///排列五
            [betModel arrangement5WithData:self.dataArr];
        }else if (betModel.lType==8){
            ///七乐彩
            [betModel sevenLecaiWithData:self.dataArr];
        }else if (betModel.lType >= 9 && betModel.lType < 15){
            ///时时彩
            [betModel allTimeWithData:self.dataArr];
        }else if (betModel.lType >= 15 && betModel.lType < 38){
            ///11选5
            [betModel select5WithData:self.dataArr];
        }else if ((betModel.lType >= 38 && betModel.lType < 51) || betModel.lType == 65){
            ///快三
            [betModel select5WithData:self.dataArr];
        }else if (betModel.lType >= 51 && betModel.lType < 60){
            ///快乐10分
            [betModel happy10WithData:self.dataArr];
        }else if (betModel.lType >= 60 && betModel.lType < 63){
            ///快乐12
            [betModel happy12WithData:self.dataArr];
        }else if (betModel.lType<65){
            ///pk10
            [betModel PK10WithData:self.dataArr];
        }
        
    }
    [self updateTotal];
}






#pragma mark -- 提交
- (void)submitBet{
    if (self.submitView.total==0) {
        [SVProgressHUD showErrorWithStatus:@"请先选择号码"];
        return;
    }
    NSString *betInfo=@"";
    for (JoinQuizModel *model in self.dataArr) {
        NSMutableArray *copyArr=[model.dataArr mutableCopy];
        [copyArr removeObject:@""];
        if (copyArr.count>0) {
            betInfo=[NSString stringWithFormat:@"%@%@*%@$",betInfo,model.title,[model.dataArr componentsJoinedByString:@"|"]];
        }
    }
    WS(weakSelf);
    [[PlanVM manage] postBetWithType:self.lType andIssue:self.topView.currentModel.CurrentIssue andBetInfo:betInfo Success:^(id returnValue) {
        MyPlanVC *vc=[[MyPlanVC alloc]init];
        [weakSelf.navigationController pushViewController:vc animated:YES];
    } andFail:^(NSString *errorMessage, NSError *error) {
        
    }];
}

- (void)showSelectView:(NSInteger)index{
    WS(weakSelf);
    JoinQuizSelectViewType type=JoinQuizSelectViewTypeHybrid;
    NSInteger   numCount=5;
    if ((self.lotteryType==LotteryNumTypeBrings&&(index==0||index==1||index==4||index==5))) {
        if (index==0||index==1) {
            numCount=4;
        }else{
            numCount=3;
        }
        type=JoinQuizSelectViewTypeNum;
    }else if ((self.lotteryType==LotteryNumTypeBrings&&(index==2||index==3||index==6||index==7))||(self.lotteryType==LotteryNumType11Select5&&(index==5))||(self.lotteryType==LotteryNumTypeHappy12&&(index==5))||(self.lotteryType==LotteryNumTypeSevenLecai&&(index<7))){
        type=JoinQuizSelectViewTypeSingle;
        numCount=1;
    }else if ((self.lotteryType==LotteryNumType11Select5&&(index==6))||(self.lotteryType==LotteryNumTypeHappy12&&(index==5))){
        type=JoinQuizSelectViewTypeTiger;
        numCount=1;
    }else if (self.lotteryType==LotteryNumTypeHappy10){
        numCount=1;
    }else if (self.lotteryType==LotteryNumTypeNearlyThree){
        if (index==0) {
            type=JoinQuizSelectViewTypeSingle;
        }
        if (index==1) {
            numCount=1;
            type=JoinQuizSelectViewTypeNum;
        }else if (index==2){
            numCount=2;
            type=JoinQuizSelectViewTypeNum;
        }
    }else if (self.lotteryType==LotteryNumTypeLottery){
        numCount=1;
        if (index==0||index==3) {
            type=JoinQuizSelectViewTypeSingle;
        }else if (index==1||index==2){
            type=JoinQuizSelectViewTypeBig;
        }else if (index==4){
            type=JoinQuizSelectViewTypeColor;
        }else if (index==5||index==6||index==7){
            type=JoinQuizSelectViewTypeZodiac;
            if (index==6) {
                numCount=4;
            }else if (index==7){
                numCount=6;
            }
        }else{
            type=JoinQuizSelectViewTypeNum;
            if (index==8) {
                numCount=20;
            }else if (index==9){
                numCount=10;
            }else if (index==10||index==11){
                numCount=5;
            }else{
                numCount=6;
            }
        }
    }else if (self.lotteryType==LotteryNumTypeArrangement3||self.lotteryType==LotteryNumTypeLottery3D){
        if (index>2) {
            type=JoinQuizSelectViewTypeNum;
            if (index==3||index==5) {
                numCount=1;
            }else if (index==4||index==6){
                numCount=2;
            }else{
                numCount=3;
            }
        }
    }else if (self.lotteryType==LotteryNumTypeSevenLecai){
        type=JoinQuizSelectViewTypeNum;
        if (index==7) {
            numCount=1;
        }else if (index==8){
            numCount=2;
        }else if (index==9||index==10){
            numCount=3;
        }else{
            numCount=5;
        }
    }else if (self.lotteryType==LotteryNumTypeChromosphere){
        if (index==0) {
            type=JoinQuizSelectViewTypeNum;
            numCount=2;
        }else if (index<3) {
            type=JoinQuizSelectViewTypeNum;
            numCount=3;
        }else if (index==3||index==6||index==5){
            type=JoinQuizSelectViewTypeSingle;
            numCount=1;
        }else if (index==4){
            type=JoinQuizSelectViewTypeBig;
            numCount=1;
        }else if (index==8){
            type=JoinQuizSelectViewTypeNum;
            numCount=8;
        }else if (index==7){
            type=JoinQuizSelectViewTypeNum;
            numCount=5;
        }
    }else if (self.lotteryType==LotteryNumTypeAllTime){
        if (index>4) {
            type=JoinQuizSelectViewTypeSingle;
        }
    }else if (self.lotteryType==LotteryNumTypeHappy12){
        if (index==0) {
            numCount=6;
        }
    }
    JoinQuizModel *model=self.dataArr[index];
    JoinQuizSelectView *view=[[JoinQuizSelectView alloc]initWithType:self.lotteryType andViewType:type andSelectArr:model.dataArr andSuccess:^(NSMutableArray *arr) {
        model.dataArr=arr;
        [weakSelf.tableView reloadData];
        [weakSelf updateTotal];
    }];
    view.numCount=numCount;
    [view show];
}

///更新已选总注数
- (void)updateTotal{
    NSInteger total=0;
    for (JoinQuizModel *model in self.dataArr) {
        NSMutableArray *copyArr=[model.dataArr mutableCopy];
        [copyArr removeObject:@""];
        total+=copyArr.count;
    }
    [self.submitView setTotal:total];
}



#pragma mark -- UITableViewDelegate ,UITableViewDataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 1;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (self.lotteryType==LotteryNumTypeBrings) {
        return 50;
    }
    JoinQuizModel *model=self.dataArr[indexPath.row];
    if (self.lotteryType==LotteryNumTypeLottery&&model.dataArr.count>0) {
        NSString *str=model.dataArr[0];
        if (str.length>0) {
            if ([model.title isEqualToString:@"二十码中特"]) {
                return real_size(26*3);
            }else if ([model.title isEqualToString:@"十码中特"]){
                return real_size(26*2);
            }
            
        }
        
    }
    NSMutableArray *copyArr=[model.dataArr mutableCopy];
    [copyArr removeObject:@""];
    if (copyArr.count==0) {
        return 50;
    }
    return ceilf(copyArr.count/2.0)*50;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.dataArr.count;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    JoinQuizDetailCell *cell=[tableView dequeueReusableCellWithIdentifier:@"JoinQuizDetailCell" forIndexPath:indexPath];
    cell.lType=self.lotteryType;
    [cell setModel:self.dataArr[indexPath.row] andIsLast:indexPath.row==self.dataArr.count-1];
    WS(weakSelf);
    cell.selectNumBlock = ^{
        [weakSelf showSelectView:indexPath.row];
    };
    return cell;
}



#pragma mark -- 懒加载
- (UITableView *)tableView{
    if (!_tableView) {
        WS(weakSelf);
        _tableView=[[UITableView alloc]init];
        _tableView.dataSource=self;
        _tableView.delegate=self;
        _tableView.backgroundColor=DEFAULTBGCOLOR;
        UIView *headView=[[UIView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 10)];
        _tableView.tableHeaderView=headView;
        [_tableView registerClass:[JoinQuizDetailCell class] forCellReuseIdentifier:@"JoinQuizDetailCell"];
        _tableView.separatorStyle=UITableViewCellSeparatorStyleNone;
        [self.view addSubview:_tableView];
        [_tableView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.equalTo(weakSelf.view);
            make.top.equalTo(weakSelf.topView.mas_bottom);
            make.bottom.equalTo(weakSelf.submitView.mas_top);
        }];
    }
    return _tableView;
}

- (JoinQuizDetailTopView *)topView{
    if (!_topView) {
        WS(weakSelf);
        _topView=[[JoinQuizDetailTopView alloc]initWithType:self.lotteryType];
        [_topView setLType:self.lType];
        _topView.openBlock = ^(BOOL isOpen) {
            [weakSelf showMoreView:isOpen];
        };
        _topView.RotaryHeaderBlock = ^(NSString *rotaryHeader) {
            if ([rotaryHeader isEqualToString:@"正在开奖"]) {
                weakSelf.labRotaryHeader.hidden=YES;
            }else{
                rotaryHeader=[rotaryHeader stringByReplacingOccurrencesOfString:@":" withString:@""];
                NSInteger value=30;
                if (self.lType<9) {
                    value=500;
                }
                if ([rotaryHeader integerValue]>value) {
                    weakSelf.labRotaryHeader.hidden=YES;
                }else{
                    weakSelf.labRotaryHeader.hidden=NO;
                }
            }
        };
        [self.view addSubview:_topView];
        [_topView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.top.equalTo(weakSelf.view);
            make.height.mas_equalTo(@90);
        }];
    }
    return _topView;
}

- (void)showMoreView:(BOOL)isOpen{
    if (isOpen) {
        WS(weakSelf);
        moreView=[[JoinQuizMoreView alloc]init];
        moreView.moreBlock = ^{
            OpenLotteryRecordVC *vc=[[OpenLotteryRecordVC alloc]init];
            vc.lType=[NSString stringWithFormat:@"%ld",weakSelf.lType];
            vc.lotteryType=weakSelf.lotteryType;
            vc.title=[NSString stringWithFormat:@"开奖记录"];
            [weakSelf.navigationController pushViewController:vc animated:YES];
        };
        [moreView setData:self.topView.more andType:self.lotteryType];
        [self.view addSubview:moreView];
        [moreView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.bottom.equalTo(weakSelf.view);
            make.top.equalTo(weakSelf.topView.mas_bottom);
        }];
    }else{
        [moreView removeFromSuperview];
        moreView=nil;
    }
}

- (JoinQuizDetailSubmitView *)submitView{
    if (!_submitView) {
        WS(weakSelf);
        _submitView=[[JoinQuizDetailSubmitView alloc]init];
        [_submitView setTotal:0];
        _submitView.submitBlock = ^{
            [weakSelf submitBet];
        };
        _submitView.cleanBlock = ^{
            weakSelf.dataArr=nil;
            [weakSelf.tableView reloadData];
            [weakSelf updateTotal];
        };
        [self.view addSubview:_submitView];
        [_submitView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.bottom.equalTo(weakSelf.view);
            make.height.mas_equalTo(@50);
        }];
    }
    return _submitView;
}

- (QXLable *)labRotaryHeader{
    if (!_labRotaryHeader) {
        _labRotaryHeader=[[QXLable alloc]initCenterTextWithText:@"已封盘"];
        _labRotaryHeader.textColor=[UIColor whiteColor];
        _labRotaryHeader.font=[UIFont systemFontOfSize:19];
        _labRotaryHeader.userInteractionEnabled=YES;
        _labRotaryHeader.backgroundColor=[UIColor colorWithHexString:@"#f13131" alpha:.8];
        [self.submitView addSubview:_labRotaryHeader];
        [_labRotaryHeader mas_makeConstraints:^(MASConstraintMaker *make) {
            make.edges.equalTo(self.submitView);
        }];
    }
    return _labRotaryHeader;
}

- (NSMutableArray *)dataArr{
    if (!_dataArr) {
        _dataArr=[[NSMutableArray alloc]init];
        if (self.lotteryType==LotteryNumTypeCarPK10||self.lotteryType==LotteryNumTypeLuckyAirship) {
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"冠军" andArr:[[NSMutableArray alloc]initWithObjects:@"",@"",@"",@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"亚军" andArr:[[NSMutableArray alloc]initWithObjects:@"",@"",@"",@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"第三名" andArr:[[NSMutableArray alloc]initWithObjects:@"",@"",@"",@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"第四名" andArr:[[NSMutableArray alloc]initWithObjects:@"",@"",@"",@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"第五名" andArr:[[NSMutableArray alloc]initWithObjects:@"",@"",@"",@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"第六名" andArr:[[NSMutableArray alloc]initWithObjects:@"",@"",@"",@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"第七名" andArr:[[NSMutableArray alloc]initWithObjects:@"",@"",@"",@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"第八名" andArr:[[NSMutableArray alloc]initWithObjects:@"",@"",@"",@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"第九名" andArr:[[NSMutableArray alloc]initWithObjects:@"",@"",@"",@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"第十名" andArr:[[NSMutableArray alloc]initWithObjects:@"",@"",@"",@"", nil]]];
        }else if (self.lotteryType==LotteryNumTypeBrings){
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"前区4码" andArr:[[NSMutableArray alloc]initWithObjects:@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"前区杀4码" andArr:[[NSMutableArray alloc]initWithObjects:@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"前区龙头单双" andArr:[[NSMutableArray alloc]initWithObjects:@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"前区凤尾单双" andArr:[[NSMutableArray alloc]initWithObjects:@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"后区3码" andArr:[[NSMutableArray alloc]initWithObjects:@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"后区杀3码" andArr:[[NSMutableArray alloc]initWithObjects:@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"后区龙头单双" andArr:[[NSMutableArray alloc]initWithObjects:@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"后区凤尾单双" andArr:[[NSMutableArray alloc]initWithObjects:@"", nil]]];
        }else if (self.lotteryType==LotteryNumType11Select5||self.lotteryType==LotteryNumTypeHappy12){
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"第一球" andArr:[[NSMutableArray alloc]initWithObjects:@"",@"",@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"第二球" andArr:[[NSMutableArray alloc]initWithObjects:@"",@"",@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"第三球" andArr:[[NSMutableArray alloc]initWithObjects:@"",@"",@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"第四球" andArr:[[NSMutableArray alloc]initWithObjects:@"",@"",@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"第五球" andArr:[[NSMutableArray alloc]initWithObjects:@"",@"",@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"总和" andArr:[[NSMutableArray alloc]initWithObjects:@"",@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"龙虎" andArr:[[NSMutableArray alloc]initWithObjects:@"", nil]]];
        }else if (self.lotteryType==LotteryNumTypeHappy10){
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"第一球" andArr:[[NSMutableArray alloc]initWithObjects:@"",@"",@"",@"",@"",@"",@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"第二球" andArr:[[NSMutableArray alloc]initWithObjects:@"",@"",@"",@"",@"",@"",@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"第三球" andArr:[[NSMutableArray alloc]initWithObjects:@"",@"",@"",@"",@"",@"",@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"第四球" andArr:[[NSMutableArray alloc]initWithObjects:@"",@"",@"",@"",@"",@"",@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"第五球" andArr:[[NSMutableArray alloc]initWithObjects:@"",@"",@"",@"",@"",@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"第六球" andArr:[[NSMutableArray alloc]initWithObjects:@"",@"",@"",@"",@"",@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"第七球" andArr:[[NSMutableArray alloc]initWithObjects:@"",@"",@"",@"",@"",@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"第八球" andArr:[[NSMutableArray alloc]initWithObjects:@"",@"",@"",@"",@"",@"", nil]]];
        }else if (self.lotteryType==LotteryNumTypeNearlyThree){
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"和值" andArr:[[NSMutableArray alloc]initWithObjects:@"",@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"独胆" andArr:[[NSMutableArray alloc]initWithObjects:@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"双胆" andArr:[[NSMutableArray alloc]initWithObjects:@"", nil]]];
        }else if (self.lotteryType==LotteryNumTypeLottery){
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"特码单双" andArr:[[NSMutableArray alloc]initWithObjects:@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"特码大小" andArr:[[NSMutableArray alloc]initWithObjects:@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"特尾大小" andArr:[[NSMutableArray alloc]initWithObjects:@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"特合单双" andArr:[[NSMutableArray alloc]initWithObjects:@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"特码波色" andArr:[[NSMutableArray alloc]initWithObjects:@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"平特一肖" andArr:[[NSMutableArray alloc]initWithObjects:@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"四肖中特" andArr:[[NSMutableArray alloc]initWithObjects:@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"六肖中特" andArr:[[NSMutableArray alloc]initWithObjects:@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"二十码中特" andArr:[[NSMutableArray alloc]initWithObjects:@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"十码中特" andArr:[[NSMutableArray alloc]initWithObjects:@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"平五码" andArr:[[NSMutableArray alloc]initWithObjects:@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"五不中" andArr:[[NSMutableArray alloc]initWithObjects:@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"六不中" andArr:[[NSMutableArray alloc]initWithObjects:@"", nil]]];
        }else if (self.lotteryType==LotteryNumTypeArrangement3||self.lotteryType==LotteryNumTypeLottery3D){
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"第一球" andArr:[[NSMutableArray alloc]initWithObjects:@"",@"",@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"第二球" andArr:[[NSMutableArray alloc]initWithObjects:@"",@"",@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"第三球" andArr:[[NSMutableArray alloc]initWithObjects:@"",@"",@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"杀一码" andArr:[[NSMutableArray alloc]initWithObjects:@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"杀二码" andArr:[[NSMutableArray alloc]initWithObjects:@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"胆一码" andArr:[[NSMutableArray alloc]initWithObjects:@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"胆二码" andArr:[[NSMutableArray alloc]initWithObjects:@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"胆三码" andArr:[[NSMutableArray alloc]initWithObjects:@"", nil]]];
        }else if (self.lotteryType==LotteryNumTypeArrangement5){
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"第一球" andArr:[[NSMutableArray alloc]initWithObjects:@"",@"",@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"第二球" andArr:[[NSMutableArray alloc]initWithObjects:@"",@"",@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"第三球" andArr:[[NSMutableArray alloc]initWithObjects:@"",@"",@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"第四球" andArr:[[NSMutableArray alloc]initWithObjects:@"",@"",@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"第五球" andArr:[[NSMutableArray alloc]initWithObjects:@"",@"",@"", nil]]];
        }else if (self.lotteryType==LotteryNumTypeSevenLecai){
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"第一球" andArr:[[NSMutableArray alloc]initWithObjects:@"",@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"第二球" andArr:[[NSMutableArray alloc]initWithObjects:@"",@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"第三球" andArr:[[NSMutableArray alloc]initWithObjects:@"",@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"第四球" andArr:[[NSMutableArray alloc]initWithObjects:@"",@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"第五球" andArr:[[NSMutableArray alloc]initWithObjects:@"",@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"第六球" andArr:[[NSMutableArray alloc]initWithObjects:@"",@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"第七球" andArr:[[NSMutableArray alloc]initWithObjects:@"",@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"胆一码" andArr:[[NSMutableArray alloc]initWithObjects:@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"胆二码" andArr:[[NSMutableArray alloc]initWithObjects:@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"胆三码" andArr:[[NSMutableArray alloc]initWithObjects:@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"杀三码" andArr:[[NSMutableArray alloc]initWithObjects:@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"杀五码" andArr:[[NSMutableArray alloc]initWithObjects:@"", nil]]];
        }else if (self.lotteryType==LotteryNumTypeSevenStars){
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"第一球" andArr:[[NSMutableArray alloc]initWithObjects:@"",@"",@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"第二球" andArr:[[NSMutableArray alloc]initWithObjects:@"",@"",@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"第三球" andArr:[[NSMutableArray alloc]initWithObjects:@"",@"",@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"第四球" andArr:[[NSMutableArray alloc]initWithObjects:@"",@"",@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"第五球" andArr:[[NSMutableArray alloc]initWithObjects:@"",@"",@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"第六球" andArr:[[NSMutableArray alloc]initWithObjects:@"",@"",@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"第七球" andArr:[[NSMutableArray alloc]initWithObjects:@"",@"",@"", nil]]];
        }else if (self.lotteryType==LotteryNumTypeChromosphere){
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"红2胆" andArr:[[NSMutableArray alloc]initWithObjects:@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"红3胆" andArr:[[NSMutableArray alloc]initWithObjects:@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"杀3红" andArr:[[NSMutableArray alloc]initWithObjects:@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"蓝单双" andArr:[[NSMutableArray alloc]initWithObjects:@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"蓝大小" andArr:[[NSMutableArray alloc]initWithObjects:@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"龙头单双" andArr:[[NSMutableArray alloc]initWithObjects:@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"凤尾单双" andArr:[[NSMutableArray alloc]initWithObjects:@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"蓝5码" andArr:[[NSMutableArray alloc]initWithObjects:@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"篮球8码" andArr:[[NSMutableArray alloc]initWithObjects:@"", nil]]];
        }else if (self.lotteryType==LotteryNumTypeAllTime){
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"第一球" andArr:[[NSMutableArray alloc]initWithObjects:@"",@"",@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"第二球" andArr:[[NSMutableArray alloc]initWithObjects:@"",@"",@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"第三球" andArr:[[NSMutableArray alloc]initWithObjects:@"",@"",@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"第四球" andArr:[[NSMutableArray alloc]initWithObjects:@"",@"",@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"第五球" andArr:[[NSMutableArray alloc]initWithObjects:@"",@"",@"", nil]]];
            [_dataArr addObject:[[JoinQuizModel alloc]initWithTitle:@"总和" andArr:[[NSMutableArray alloc]initWithObjects:@"",@"", nil]]];
        }
    }
    return _dataArr;
}

- (void)setLType:(NSInteger)lType{
    _lType=lType;
    [self getPlan];
    self.lotteryType=[[BaseVM manage] getType:lType];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
